| Class | SimplyPresentable::ActiveRecordTagPresenter |
| In: |
vendor/plugins/simply_presentable/lib/simply_presentable/presenter/active_record_tag.rb
|
| Parent: | SimplyPresentable::ActiveRecordPresenter |
| SUPPORTED_TAGS | = | %w{a abbr acronym address applet area b base basefont bdo big blockquote body br button caption center cite code col colgroup dd del dfn dir div dl dt em fieldset font form frame frameset h1 h2 h3 h4 h5 h6 head hr html i iframe img input ins isindex kbd label legend li link map menu meta noframes noscript object ol optgroup option p param pre q s samp script select small span strike strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var} |
Create a tag with attributes based on the record
<% present(Foo.find(1)).tag(:div, :dom_prefix => 'bar', :title => 'a foo') do %>
Hello
<% end %>
=> <div id='bar_foo_1' class='bar_foo' title='a foo'>Hello</div>
Options:
| :dom_prefix: | See ActiveRecordDomPresenter |
Any other option passed in will be included in the attributes for the tag
# File vendor/plugins/simply_presentable/lib/simply_presentable/presenter/active_record_tag.rb, line 15
15: def tag(name, options = {}, &proc)
16: local_options = options.dup
17: dom_prefix = local_options.delete(:dom_prefix)
18: @renderer.concat(
19: @renderer.content_tag(
20: name,
21: @renderer.capture(&proc),
22: local_options.merge(
23: :id => @presenter_proxy.dom_id(:dom_prefix => dom_prefix),
24: :class => [options[:class], @presenter_proxy.dom_class(:dom_prefix => dom_prefix)].compact.join(' ')
25: )
26: ),
27: proc.binding
28: )
29: end